package com.lzctzk.serviceaddress.result;


/**
 * Title:
 * Description:
 * Company:
 *
 * @user GuiYue
 * @time 18:20
 * @project_name smartcommunity
 * @package_name com.ctzk.smartcommunity
 **/


public class Result
{
    /**
     * status:状态码  约定：200代表成功,400代表用户错误，500代表服务器错误
     * msg：消息
     * data：回传数据
     */
    private Integer status;
    private String msg;
    private Object data;

    //全面定制返回
    public static Result build(Integer status, String msg, Object object)
    {
        return new Result(status, msg, object);
    }

    public static Result ok(Object object)
    {
        return new Result(200, "ok", object);
    }
    //只提供消息的简洁Ok
    public static Result ok()
    {
        return new Result(200, "ok");
    }
    //简洁错误
    public static Result error(Integer status, String msg)
    {
        return new Result(status, msg);
    }

    private Result(Integer status, String msg, Object data)
    {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    private Result(Integer status, String msg)
    {
        this.status = status;
        this.msg = msg;
    }

    public Integer getStatus()
    {
        return status;
    }

    public void setStatus(Integer status)
    {
        this.status = status;
    }

    public String getMsg()
    {
        return msg;
    }

    public void setMsg(String msg)
    {
        this.msg = msg;
    }

    public Object getData()
    {
        return data;
    }

    public void setData(Object data)
    {
        this.data = data;
    }
}
